Skip to content

Inkling 2 Mini DSpark on Metal: the block attends on the M5 tensor units, so a hold stays near flat in context (10.55 to 5.63 ms at 128K) - #4660

Open
sethforprivacy wants to merge 5 commits into
ashhart:mainfrom
sethforprivacy:inkling2-mini-metal-dspark-units
Open

sethforprivacy wants to merge 5 commits into
ashhart:mainfrom
sethforprivacy:inkling2-mini-metal-dspark-units

Conversation

@sethforprivacy

@sethforprivacy sethforprivacy commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Before: a DSpark block's attention scores every kept key of its context on scalar threads, so a drafter's hold grows with the context. With one stream, main's median hold is 4.08 ms at 1K and 10.55 ms at 128K.

After, where the GPU has tensor units: the block attends on the tensor units, a chunk of its context a threadgroup, and the median hold is 4.04 ms at 1K and 5.63 ms at 128K. Replies are token-for-token the same as main's. Without tensor units the block takes main's kernel, and admission charges what main does.

This is a re-cut onto main. The drafter is opt-in (--drafter), and only the drafter's own sums change.

The two kernels (dspark_units.metal, loaded only where the GPU has tensor units):

  • tf_ink2_dspark_attn_units: a threadgroup is one key head and one chunk of 256 kept keys. Scores and weighted values are tensor products over 64-key tiles read from the context ring, with a running peak and mass a (row, head) pair. It writes a partial a pair and chunk.
  • tf_ink2_dspark_attn_merge: a threadgroup is one (row, head). It scores the block's own eight keys first, then folds the chunks' partials in order and rounds once to BF16. Because the block's keys come first, ll >= 1 before any chunk, so an empty chunk adds nothing and there is no 0 / 0.

All three drafter layers take them: the two sliding layers over their last 1,024 keys and the global layer over everything kept.

The store. The partials live in a store the drafter holds (dspark_units.zig), sized from the context capacity. scoreBytes charges it only where State.held() is true, so a Mac without tensor units admits what main does; the native opener and admit.demandAt pass that through. attend checks every stream's span against the store in every build, and a context past it takes main's kernel instead of writing past the store.

Which bits change. Only the drafter's: a weight is rounded to BF16 before it multiplies a value, as the target's prompt attention does, and the sums run a tile at a time instead of in key order. A draft is a proposal the target verifies, so no reply changes. What can move is how many drafts land, and acceptance stays within about 2 points of main's everywhere below.

Checks on this head

  • Head commit: 9f106c814. The code is 232fbfa2e's; the two commits after it touch only docs/receipts/.
  • Tests run on a Mac Studio M5 Ultra, against main 0ca167746 with the same script:
    • tf-kernel-contract: the units' contract entries (metal_inkling2_dspark_units.zig, checked against a float64 softmax within a stated bound, with planted controls) build. The contract run aborts (134) on main too.
    • Host tests: the span a block reads in whole chunks (dspark_kernels_test.zig); the store's bound at tile edges up to 1,048,576 tokens (dspark_units.zig); admission at fixed budgets with and without the store (inkling2_admit_test.zig).
    • zig build native -Dcpu=apple_m1: compiles.
    • The Inkling host steps: the same five failures as main (the NVFP4 capabilities count, the DSpark serving test, the two EXL3 serving tests and TFQ5 split-K), and nothing new.
    • Lean checker: 0 new problems. zig fmt --check and git diff --check: clean.
  • CI: zig passes on this head.
  • Not run: M1 to M4, which never load these kernels. CUDA and HIP are not touched.

Receipt

  • docs/receipts/inkling2-mini-metal-dspark-units/perf-receipt.json, from main's tools/perf_receipt.py run on the M5 Ultra: main 0ca167746 against 9abef9e21, drafter on, two ABBA pairs, the planted control, --check-draft. Its pack is committed beside it, pack-long-128k.json: two prompts, a greedy one and a seeded one, each 131,072 tokens of TensorFold's own docs/**/*.md at 0ca167746, cut by the checkpoint's tokenizer, with 256 tokens out.
    • Speed: +6.70 % (38.984 to 41.597 tok/s, base-vs-base noise 1.43 %). All four head rounds (41.2 to 41.8) beat all four base rounds (38.6 to 39.1).
    • Exactness passes: both prompts' tokens equal main's, drafted equals plain on the head, and the control diverges.
    • verify --pack docs/receipts/inkling2-mini-metal-dspark-units/pack-long-128k.json passes with the speed floor. CI's verify checks every receipt against tools/receipt_prompts.json, so it reports a pack mismatch here.
    • An earlier receipt on main's short-prompt pack measured -0.40 % (noise 0.34 %): at short context the hold is already flat, so there is nothing for this to gain.
  • The claim, measured separately on the same machine (Inkling-2-Mini fcd43a42), with 1K to 128K prompts, one and four streams, greedy and sampled:
    • All 40 rows match main token for token.
    • The drafter's median hold, one stream: 4.04 to 5.63 ms from 1K to 128K, against 4.08 to 10.55 on main. At 64K and up with two streams: 10.50 to 6.64 ms.
    • Drafted decode with one stream moves by 2 % or less either way.
    • The hold times come from a local timing patch that is not on this branch.
  • New switch: none. The kernels run where the GPU has tensor units and the drafter is on.
  • Licence of any new weights or drafter: n/a.

Checklist

  • The title and description match the head commit, including the receipt.
  • New tests fail before the change and pass after it.
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.
  • Every token still goes through the lane rounds.
  • Drafted output equals main's, and concurrent equals solo (four streams above).
  • The drafter's sums change, as said above; the target's don't.
  • Drafted decode at one stream is within 2 % of main's either way, and at 64K and up the hold is shorter.

@ashhart

ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Sorry for the noise: this was closed automatically when #4387 landed on main and its base branch was removed. It is reopened and now targets main. We will follow up here on what it needs next; nothing is needed from you yet.

  • Synthena

@Spectre056

Copy link
Copy Markdown

I can run this one on an M5 Max as well, alongside #4631: Apple M5 Max (40-core GPU), 128 GB, macOS build 26B131, Zig 0.17.0.

Plan: thinkingmachines/Inkling-2-Mini@ed40e7da with --drafter, without and with this commit. Cells: drafted decode after about 44K and 92K-token prompts, the per-hold time if a profile switch reports it, accepted drafts per prompt, and each reply's hash against its plain run.

Same question as on #4631: main plus the stack at your listed heads, or a narrower base? I'll post the results with receipts.

@sethforprivacy

Copy link
Copy Markdown
Contributor Author

@Spectre056 thank you. The same answer as on #4631, with one difference. The base is moving (#4387 is on main and the maintainers are rebasing this stack themselves), so I would wait for the rebased head before spending time on it.

The difference: this PR changes only the drafter. The target verifies every draft, and on the full stack 24 of 24 greedy replies were identical with the drafter's attention on the tensor units, on its scalar kernel and with no drafter (accepted drafts 4,021 of 9,498 against 4,013 of 9,112). So replies do not move here; what the tensor-unit sums change is the drafter's own arithmetic. Whether that passes the bit-equality rule from #4448 is the maintainers' call and has not been said yet. Once there is a head on main to run, I will post it here.

@Spectre056

Copy link
Copy Markdown

Understood, thanks for the detail on the drafter. I'll wait for the head on main and run it when you post it here.

@ashhart

ashhart commented Dec 1, 2026

Copy link
Copy Markdown
Owner

@sethforprivacy, the rebase onto main is pushed: cf447ccfac is your commit 28a0b4638f on today's main, with your authorship and message kept.

The other 14 commits on the branch are dropped, because main already holds each of them:

Your commit On main as
9922582308 806065188449
c68340d31f 1ba8d16a8002
819edd9bd1 d23048962
5ea131a37f 369711412409
1129a91fb3 30bb8e8dffa3, since replaced by main's tiled projection
e4fea4d8df 121add6e3961, since replaced by the online-softmax attention
d00306598a ae3525166928
ec483711dc 23f398486104, since raised to seven drafts
57f8bc5188 6ecc6c99f6af
84c393292a 26ce4c32027c
db534d6cfd 702e2bbd4fe0
779dcf11c3 e236753f5070
20933682bc d326fdac4a8b
03bb79eccc a43cb8024be5

What's left is the change only this PR makes: splitting the M5 DSpark block attention across context chunks and folding their partials. Main's attention has changed a lot since 22 Nov, so we'll review it fresh on this head. Then we'll run the M5 checks against main: tokens with the drafter on and off, and hold time across context lengths. Nothing is needed from you in the meantime.

  • Synthena

@ashhart

ashhart commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Thanks @sethforprivacy. #4660 is one commit, the block attends on the tensor units, a chunk of its context a threadgroup, so a hold costs the same at any context, and it merges cleanly onto today's main.

Exactness

  • zig/src/families/inkling2/metal/dspark.zig:372: on a GPU with tensor units, the DSpark drafter's block attention now runs on the new units kernels (partial sums for each 256-key chunk, then a fold). On other GPUs it falls back to main's kernel (dspark_units.zig:22). This changes the drafter's own arithmetic, so its proposals can differ. Served tokens stay main's as long as every proposal is checked against the target and the reply takes the target's own draw, which is how drafting works here. So the default-path bits are unchanged, and what can move is the acceptance rate and the speed.

  • The served A/B you ran (main against this head, identical tokens) is the evidence for that end to end. It covers the prompts, context lengths and settings it used, on the GPU it ran on. It doesn't cover:

    • contexts past the drafter's 1,024-token sliding window, where unitsSpan starts the local layers at committed - 1024;
    • several streams holding at once (the batched hold takes up to 8);
    • sampled requests;
    • GPUs without tensor units, which still run main's kernel.

    Mentioning which of those it included would help.

Asks

  • Admission on GPUs without tensor units. dspark_units.zig:7: Drafter.scoreBytes now always returns the units partial store, about 390 bytes per token of window. Main returned 0. The opener charges it to every DSpark stream budget, through admit.zig:24 and zig/src/native/inkling2.zig:53 (with its fixed share at :35). A GPU without tensor units never allocates that store (State.init returns empty there), yet it would now admit fewer streams, or a shorter window, than on main. Please make scoreBytes depend on whether the device has the units, or charge it only where State allocates.
  • The speed claim. "A hold costs the same at any context" is the point of the change. Please show the hold time against context length.

Tests

  • The new contract (metal_inkling2_dspark_units.zig) checks the partial and fold kernels against an FP64 reference, with planted controls. The launch records are added.
  • dspark_units.zig's host test bounds the partial store at every capacity.

Repo checks we ran on this branch:

  • zig fmt and ast-check are clean.
  • The lean check is unchanged.
  • No Zig file is over 600 lines.
  • No new environment variables, and no serving pins touched.

The M5 check we'd like to see, main against this branch:

  • Drafted tokens per second and acceptance rate at 1K, 8K, 32K and 128K contexts, with one stream and with four.

  • The hold time against context length.

  • The same greedy tokens as main at each length.

  • On a Mac without tensor units: the number of streams admitted at a fixed budget, unchanged from main.

  • Synthena

@sethforprivacy

Copy link
Copy Markdown
Contributor Author

Thanks, @ashhart. Both asks make sense:

  • Admission: I'll make scoreBytes 0 where State allocates no units store, so a Mac without tensor units admits exactly what main does, with a host test at a fixed budget.
  • Coverage: I'll rerun the served A/B against main on this head at 1K, 8K, 32K and 128K (so past the drafter's 1,024-token window), with one stream and with four holding at once, greedy and sampled. Each will report drafted tokens per second, acceptance, hold time against context, and greedy tokens compared with main. I can't run a Mac without tensor units, so that row will be the admission test plus the fallback to main's kernel.

@sethforprivacy

Copy link
Copy Markdown
Contributor Author

Pushing the re-cut head now: cf447ccfa → 41b31aea7, on today's main. Receipts in the next comment.

@sethforprivacy
sethforprivacy force-pushed the inkling2-mini-metal-dspark-units branch from cf447cc to 41b31ae Compare December 2, 2026 03:21
@sethforprivacy

Copy link
Copy Markdown
Contributor Author

New head 41b31aea7: your rebase cf447ccfa onto main at f38491ee6, plus one commit for admission.

Admission: dspark_state.scoreBytes(capacity, units) is 0 when the drafter holds no units store, and dspark_units.State.held() says whether it does. native/inkling2.zig and admit.demandAt(..., units) charge the partial store only where it exists, so a Mac without tensor units admits exactly what main does. Host tests: the admit test checks that a drafter without the store is charged no score bytes at 1K to 128K on a 48 GB budget, and inkling2.zig checks that the longest context a budget allows is then main's.

Repo checks (M5 Ultra, Inkling 2 Mini checkpoint present, a fresh test binary):

  • Native build ok.
  • tf-kernel-contract --only inkling2: the same single red as main (tf_inkling2_conv_dynamic_segs, "a run changed its inputs"); every planted control red.
  • Inkling host steps fail only main's own six: the NVFP4 capabilities count, the two DSpark serving tests, EXL3 serving, the TFQ5 split-K heuristic and gpu_tokens at ring 4096.
  • zig fmt, diff check, lean unchanged against main; no Zig file over 600 lines.

The M5 runs below were on main at c13f43e3d; the head is the same patch rebased onto f38491ee6, whose 20 commits don't touch the Metal path.

M5 served, main against this branch, 1K, 8K, 32K and 128K prompts, one stream and four at once, greedy and sampled (temperature 0.7, seeded), 256 tokens each:

Tokens: equal ids, sha and top logprobs in all 40 rows, 20 greedy and 20 sampled.

Acceptance (accepted / drafted, from the server's per-request lines), main → branch:

1K 8K 32K 128K
greedy, 1 stream 0.44 → 0.42 0.51 → 0.50 0.34 → 0.35 0.57 → 0.57
greedy, 4 streams 0.62 → 0.62 0.44 → 0.45 0.54 → 0.53 0.63 → 0.62
sampled, 1 stream 0.29 → 0.31 0.35 → 0.34 0.29 → 0.29 0.47 → 0.47
sampled, 4 streams 0.31 → 0.31 0.29 → 0.30 0.40 → 0.39 0.46 → 0.48

Hold time (the drafter's attention per round, median ms, from a local timing patch that isn't on the branch), main → branch:

context 1 stream 2 streams 4 streams
under 2K 4.08 → 4.04 4.22 → 4.37 6.5 → 7.1 (one sample)
2K–16K 5.07 → 4.77 5.02 → 4.86 10.20 → 9.92
16K–64K 6.15 → 4.92 6.21 → 5.70 10.70 → 10.53
64K and up 10.55 → 5.63 10.50 → 6.64 14.5 → 12.7 (one sample)

Drafted decode, one stream (tok/s), main → branch: greedy 42.1 → 41.4 (1K), 49.9 → 49.3 (8K), 21.0 → 21.4 (32K), 57.8 → 59.1 (128K); sampled 33.5 → 33.1, 33.4 → 33.6, 19.1 → 19.3, 45.5 → 46.6. With four streams, each stream's rate mostly measures its wait behind the others' prompts, so I'm not comparing those.

So the hold is close to flat in context now (one stream: 4.0 to 5.6 ms from 1K to 128K, against 4.1 to 10.6 on main), with the same tokens and the same acceptance. At these lengths that only shows as a small decode change, because the target's own long-context step dominates.

Not covered: a Mac without tensor units. That row is the admission test plus the fallback to main's kernel.

@ashhart

ashhart commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Thanks for the admission fix and the re-cut, which close both review asks.

Decision: waiting on the M5 cells the review named, which are ours: we've queued them on our M5 Ultra - drafted tokens per second and acceptance at 1K, 8K, 32K and 128K with one stream and four holding at once, greedy and sampled, the hold time against context length, and the same greedy tokens as main at each length. Your posted table covers much of it (the hold close to flat in context).

What stands: the block attends on the tensor units a chunk a threadgroup, a hold takes 3.4 to 3.6 ms at any context, and the admission fix makes scoreBytes 0 where no units store is held.

Main's DSpark block attention scores every kept key on scalar threads; the units kernels are not on main.

  • Synthena

@ashhart ashhart added kind:perf Classified by Synthena as performance improvement synthena:needs-receipt Speed PR awaiting verified perf_receipt.py hash run labels Dec 3, 2026
@ashhart

ashhart commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Synthena Initial Review — Performance receipt required (kind:perf)

Adds M5 tensor-unit attention kernels for Mini DSpark's block attention so holds cost a flat ~3.5 ms regardless of context, plus a contract-driver fix building Suites in place. The kernels, admission accounting, and tests are scoped, but the PR's speedup claims (3.6 ms at 276 tokens to 3.4-3.6 ms at 44K; 42.4 to 85.5 tok/s after 92K) have no verifiable benchmark receipt attached.

  • Performance claim detected without a verified tf-receipt-v1 receipt.

Performance PRs require a verifiable benchmark receipt before running project CI hardware. See CONTRIBUTING.md (Performance PRs: verifiable benchmark receipt) and attach the output of:

python3 tools/perf_receipt.py run --base-bin /path/to/base-tf --head-bin /path/to/head-tf --model /path/to/model.tfold --out receipt.json

Findings:

  • [BLOCKER] zig/kernels/metal/inkling2/dspark_units.metal: When a chunk is entirely below a.first (possible when first is not chunk-aligned, e.g. sliding layers with committed=5000, from=3 gives first=3976, which is not a multiple of 256), lo >= hi makes the threadgroup skip all tiles, leaving top = -INFINITY and mass = 0. The merge kernel then folds ml.x = -INFINITY via max(mm, ml.x) and exp2(-INFINITY - mn) = 0, which is handled, but if ALL chunks are empty and the block's own keys are also absent (committed == first, chunks == 0), ll can be 0 and o / ll divides by zero producing NaN in the output. Suggested fix: Guard the final normalization: out[q_at + d] = bfloat(ll > 0 ? o / ll : bfloat(0)); or assert in attendUnits that committed > first whenever the block has no own keys, mirroring the span.chunks != 0 guard on the partials dispatch.
  • [WARNING] zig/src/families/inkling2/metal/dspark_units.zig: setContext allocates for @max(1, ...) chunks even at capacity 0, but scoreBytes(0) returns per_chunk (one chunk's worth), so admission charges a fixed floor below 528 tokens as documented. However attend asserts k.unitsBytes(k.unitsSpan(...).chunks) <= partials.buf.length() only in debug builds; in release, an over-capacity committed (e.g. after a context resize race) would write past the private buffer with no bounds check. Suggested fix: Keep the debug assert but also clamp span.chunks to the allocated chunk count in attendUnits, or add a release-mode bounds check before dispatch.
  • [WARNING] zig/kernels/metal/inkling2/dspark_units.metal: Rows at or beyond DSU_PAIRS are clamped to pair 23 for the query pointer, so those lanes still load a real query row and compute scores that are later masked by row < DSU_PAIRS in the live check. This is correct but wastes work; more importantly, tfp::frag_get_rows(qa, qb0, qb1, 16 * d, home, row_a < DSU_PAIRS, row_b < DSU_PAIRS) passes a zero fragment for dead rows, yet qb0/qb1 were still dereferenced via the clamped pointer, which is safe only because the clamp keeps it in bounds. Suggested fix: No correctness bug, but document the clamp invariant or skip the query load entirely for dead rows to avoid relying on a subtle pointer-safety coincidence.
  • Synthena

… of its context a threadgroup, so a hold costs the same at any context
…only where it holds one, so a Mac without tensor units admits what main does
…rnel in every build, not only past a debug assert
@sethforprivacy

Copy link
Copy Markdown
Contributor Author

A new head is coming, 9abef9e21 on main 0ca167746: fixes for Synthena's findings plus an M5 Ultra perf receipt. I'll reply on each finding once it's up.

@sethforprivacy
sethforprivacy force-pushed the inkling2-mini-metal-dspark-units branch from 41b31ae to 9abef9e Compare December 3, 2026 13:08
@sethforprivacy

Copy link
Copy Markdown
Contributor Author

New head 9abef9e21, on main 0ca167746. On Synthena's three findings:

  • [BLOCKER] A chunk entirely below a.first. This is a false alarm, so the kernel is unchanged and no pins move. tf_ink2_dspark_attn_merge folds the block's own eight keys before any chunk, so mm starts out finite, and the largest of those keys weighs exp2(0) = 1, so ll >= 1. An empty chunk (acc = 0, top = -inf, mass = 0) then folds with mn = mm, x = 1 and y = exp2(-inf) = 0, which adds nothing to ll or o. No path leads to -inf - -inf or 0 / 0.
  • The capacity check was debug-only. Fixed. attend now checks the store's capacity in every build, and a context past it takes main's kernel instead of writing past the store.
  • Clamped query rows at DSU_PAIRS and beyond. As the finding says, this is correct. Those lanes load a real row so the fragment loads stay uniform, and live masks their scores. Skipping them would need a branch inside the tile loop and wouldn't change any bits.

The M5 checks, comparing main with this head:

  • The native build passes.
  • zig fmt passes, and the diff check is clean.
  • The lean check finds 0 new problems.
  • The host steps have the same five failures as main.
  • The units contract builds; tf-kernel-contract aborts (134) on main too.

About the receipt gate. I ran tools/perf_receipt.py run on the M5 Ultra, comparing main 0ca167746 with this branch. It used two ABBA pairs, the 4-prompt pack and the planted control. The receipt is committed at docs/receipts/inkling2-mini-metal-dspark-units/perf-receipt.json. It shows two things:

  • Exactness passes. The head's tokens hash to 416ad5ea…, the same as main's on every prompt, and the control diverges as it should. verify --allow-no-speedup passes.
  • The speed floor can't pass, and shouldn't. The pack measures single-stream decode on short prompts. This PR doesn't claim to change that, and the receipt shows it doesn't: -0.40% with the drafter on (56.782 to 56.554 tok/s, noise 0.34%), about the size of the base-vs-base noise. The gain this PR claims is the drafter's hold staying near flat in context (10.6 to 5.6 ms at 64K and beyond), which a short prompt never reaches, and the pack has no cell that measures it.

There's also a catch in the CI step: it checks the receipt's head_sha against the PR head. A receipt can't name the commit that adds it, so the receipt names the commit before it, 232fbfa2e. The only thing after 232fbfa2e is the receipt commit, so the code it measured is the code under review.

How do you want a claim that isn't about decode speed receipted? I can re-run with a pack you name, or the PR can carry whatever label skips the speed floor. Or, if this PR shouldn't carry kind:perf, the receipt can stay as exactness proof only.

@ashhart ashhart added synthena:needs-changes Reviewed by Synthena; changes requested and removed synthena:needs-receipt Speed PR awaiting verified perf_receipt.py hash run labels Dec 3, 2026
@ashhart

ashhart commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Synthena Initial Review — Needs changes (kind:perf)

Adds M5 tensor-unit attention kernels for Mini DSpark's block attention with a partials store, admission accounting, and contract tests, plus a driver-only Suites fix. The PR claims flat-context hold latency and higher drafted decode throughput, but the attached receipt measures short prompts only and shows a -0.4% aggregate regression.

  • Failing CI check(s): verify.

Findings:

  • [BLOCKER] docs/receipts/inkling2-mini-metal-dspark-units/perf-receipt.json: The receipt's claim text asserts flat hold latency at 64K+ contexts, but every measured prompt has 30-53 prompt tokens and 64-128 output tokens; no long-context (276/8.4K/44K/92K) measurement exists in the receipt, so the central perf claim (flat hold cost at any context, 85.5 tok/s after 92K) is unverified by the attached artifact. Suggested fix: Regenerate the receipt with long-context prompts (at least 44K and 92K prompt tokens) measuring hold time and drafted decode tok/s against base, or narrow the claim to what was measured.
  • [BLOCKER] docs/receipts/inkling2-mini-metal-dspark-units/perf-receipt.json: The receipt's own aggregate shows the head is 0.4% slower than base (mean 56.554 vs 56.782 tok/s), while the PR description claims 85.5 tok/s drafted decode after a 92K-token prompt; the artifact contradicts the PR's headline performance claim. Suggested fix: Re-run the benchmark on the actual head commit with the long-context workload and update the receipt so the recorded numbers support the claimed gains, or drop the perf claim.
  • [BLOCKER] docs/receipts/inkling2-mini-metal-dspark-units/perf-receipt.json: The receipt's head_sha (232fbfa...) does not match the PR's stated head commit (28a0b46), so the receipt was not generated from this PR's code and cannot verify its performance. Suggested fix: Regenerate the receipt from commit 28a0b46 (or the final merge head) and update base/head SHAs and binary hashes.
  • [WARNING] zig/src/families/inkling2/metal/dspark_units.zig: The fallback check runs per stream but falls back for the whole batch if any single stream's span exceeds the store; that is safe, but the store is shared across streams and layers within one serial encoder pass, so a later layer's chunks can exceed an earlier layer's allocation only if setContext under-sized it relative to the admitted window - the guard catches it at runtime with a slow scalar fallback rather than an error, which can silently negate the perf win. Suggested fix: Assert or log when the units path is skipped due to store size so admission (setContext capacity) and runtime spans are provably consistent, rather than silently degrading.
  • [WARNING] zig/kernels/metal/inkling2/dspark_units.metal: Rows past DSU_PAIRS are clamped to a valid pair index for the query pointer, relying on tfp::frag_get_rows' row_a < DSU_PAIRS / row_b < DSU_PAIRS flags to suppress those rows; if any code path reads qb0/qb1 for out-of-range rows (e.g. a future change to the frag helper), the clamp silently reads the wrong query row instead of faulting. Suggested fix: Add a comment documenting the clamp is dead-value-only, or gate the loads explicitly on the row-valid flags.
  • Synthena

@sethforprivacy sethforprivacy changed the title Inkling 2 Mini DSpark on Metal: the block attends on the M5 tensor units, so a hold costs the same at any context Inkling 2 Mini DSpark on Metal: the block attends on the M5 tensor units, so a hold stays near flat in context (10.55 to 5.63 ms at 128K) Dec 4, 2026
@ashhart

ashhart commented Dec 5, 2026

Copy link
Copy Markdown
Owner

@sethforprivacy thanks for the re-cut. A read of the current head found no problems in the kernels, the store or the admission charge, so the only thing between this and a landing train is the verify check.

That check reads the committed receipt, and it fails on the receipt's own numbers. The receipt measured short prompts, where the PR says decode stays at main's rate: the mean is -0.40% and neither ABBA pair beats base, so it cannot clear the 0.50% floor. The gain this PR claims lives at long context (the hold falling from 10.55 to 5.63 ms at 128K), and no cell in the receipt measures it.

Could you record the receipt at the context where the claim is, for example drafted decode with a 64K or 128K prompt, same ABBA order and checkpoint, on the current head? The stale-head error from 3 Dec clears on its own: the checker on main now accepts a head whose only commits after the measured one touch docs/receipts/.

  • Synthena

…park-units at 128K: drafted decode +6.7%, tokens equal main's
@sethforprivacy

Copy link
Copy Markdown
Contributor Author

Done: new head 9f106c814, which changes only docs/receipts/. The receipt is now recorded at 128K context, with the drafter on, two ABBA pairs and the planted control, on Inkling-2-Mini fcd43a42. It replaces the short-prompt one.

  • Speed: +6.70 % (38.984 to 41.597 tok/s; base-vs-base noise 1.43 %). Every head round, 41.2 to 41.8 tok/s, beats every base round, 38.6 to 39.1.
  • Exactness: both prompts' tokens equal main's, drafted equals plain on the head, and the control diverges.

The pack is committed next to the receipt as pack-long-128k.json: a greedy prompt and a seeded one, each 131,072 tokens of TensorFold's own docs/**/*.md at 0ca167746, cut by the checkpoint's tokenizer. verify --pack docs/receipts/inkling2-mini-metal-dspark-units/pack-long-128k.json passes, including the 0.50 % floor.

One catch: CI's verify step always checks against tools/receipt_prompts.json, so it will flag this receipt's pack hash and the default prompts it doesn't have. It needs to pass the receipt's own pack, or to accept a pack committed beside the receipt, before it can go green.

@ashhart

ashhart commented Dec 6, 2026

Copy link
Copy Markdown
Owner

Thanks @sethforprivacy. The admission charge and release-capacity guard close the earlier asks. The new long-context receipt supplies the requested workload and records matching outputs with a 6.7% drafted-decode gain. We will wire its approved pack into both verification stages while preserving the strict gates. No further receipt rerun is needed for the documentation-only head.

  • Synthena

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:perf Classified by Synthena as performance improvement synthena:needs-changes Reviewed by Synthena; changes requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants